< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03020205.xhp

(section: write) (bookmark: bm_id3147229)
Write statement

Write 文

Write Statement [Runtime]
Write ステートメント [実行時](hd_id3147229.1)

Writes data to a sequential file.
順編成ファイルに対してデータを書き込みます。(par_id3154685.2)

(/section: write)

Syntax:
構文:(hd_id3150449.3)

Write [#FileName], [Expressionlist]
Write [#FileName], [Expressionlist](par_id3145785.4)

Parameters:
パラメータ:(hd_id3151116.5)

FileName: Any numeric expression that contains the file number that was set by the Open statement for the respective file.
FileName: 該当ファイルに対し Open ステートメントが割り当てたファイル番号を示す数値表式。(par_id3153728.6)

Expressionlist: Variables or expressions that you want to enter in a file, separated by commas.
Expressionlist: ファイルに書き込むコンマ区切りのデータを示す、変数または表式。(par_id3146120.7)

If the expression list is omitted, the Write statement appends an empty line to the file.
式リストを省略すると、Write 文が空の行をファイルに追加します。(par_id3150010.8)

To add an expression list to a new or an existing file, the file must be opened in the Output or Append mode.
新規のファイルにせよ既存のファイルにせよ、データを書き込む場合は、該当ファイルを Output またはAppend モードでオープンしておく必要があります。(par_id3163713.9)

Strings that you write are enclosed by quotation marks and separated by commas. You do not need to enter these delimiters in the expression list.
記述した文字列は引用符で囲まれ、コンマで区切られます。 式リストにこれらの区切り記号を入力する必要はありません。(par_id3147428.10)

Each Write statement outputs a line end symbol as last entry.
Write ステートメントは、行と記号を最後の項目として出力します。(par_id1002838.)

Numbers with decimal delimiters are converted according to the locale settings.
小数点のある数値は、ロケール設定に従って変換されます。(par_id6618854.)

Example:
例:(hd_id3151073.11)

Sub ExampleWrite
Sub ExampleWrite(par_id3145252.12)

Dim iCount As Integer
Dim iCount As Integer(par_id3149958.13)

Dim sValue As String
Dim sValue As String(par_id3156284.14)

iCount = Freefile
iCount = Freefile(par_id3145645.15)

open "C:\data.txt" for OutPut as iCount
open "C:\data.txt" for OutPut as iCount(par_id3153417.16)

sValue = "Hamburg"
SValue = "Hamburg"(par_id3149401.17)

Write #iCount,sValue,200
Write #iCount,sValue,200(par_id3156275.18)

sValue = "New York"
SValue = "New York"(par_id3146913.19)

Write #iCount,sValue,300
Write #iCount,sValue,300(par_id3155064.20)

sValue = "Miami"
SValue = "Miami"(par_id3150322.21)

Write #iCount,sValue,450
Write #iCount,sValue,450(par_id3155766.22)

close #iCount
close #iCount(par_id3145643.23)

end sub
end sub(par_id3150044.24)


< Prev / Next >